#ifndef __APP_LED__
#define __APP_LED__

#include "stdint.h"
#include "bsp_cpLED.h"

#define LED_OFF (0)
#define LED_ON  (1u)

#define SEG_OFF     (0x80u)
#define SEG_REFRESH (0x40u)
#define DIR_REFRESH (0x20u)
#define SEG_P       (0x03u)
#define SEG_R       (0x02u)
#define SEG_F       (0x01u)

#define SegD1(i)   cpLED_SetPin(1,i)
#define SegE1(i)   cpLED_SetPin(2,i)
#define SegF1(i)   cpLED_SetPin(3,i)
#define SegA1(i)   cpLED_SetPin(4,i)
#define SegB1(i)   cpLED_SetPin(5,i)
#define SegC1(i)   cpLED_SetPin(6,i)
#define SegG1(i)   cpLED_SetPin(7,i)

#define SegD2(i)   cpLED_SetPin(8,i)
#define SegE2(i)   cpLED_SetPin(9,i)
#define SegF2(i)   cpLED_SetPin(10,i)
#define SegA2(i)   cpLED_SetPin(11,i)
#define SegB2(i)   cpLED_SetPin(12,i)
#define SegC2(i)   cpLED_SetPin(13,i)
#define SegG2(i)   cpLED_SetPin(14,i)

#define BAT3(i)      cpLED_SetPin(15,i)
#define BAT2(i)      cpLED_SetPin(16,i)
#define BAT1(i)      cpLED_SetPin(17,i)
#define BatF1(i)     cpLED_SetPin(18,i)
#define BatF2(i)     cpLED_SetPin(19,i)
#define BatF3(i)     cpLED_SetPin(20,i)
#define LCD_FLASH(i) cpLED_SetPin(21,i)

void LCD_Init(void);
void cpLED_Show_bat(uint8_t lv);
void LCD_BAT(uint8_t bat,bit ch,bit cf);
void LCD_ShowHex(uint8_t hex);
void LCD_ShowLevel(uint8_t level);
uint16_t map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);
#endif //__APP_LED__

